package cn.itsource.pethome.system.user.service.impl;
import cn.itsource.pethome.base.service.impl.IBaseServiceImpl;;
import cn.itsource.pethome.system.user.domain.Employee;
import cn.itsource.pethome.system.user.domain.EmployeeBo;
import cn.itsource.pethome.system.user.mapper.EmployeeMapper;
import cn.itsource.pethome.system.user.service.IEmployeeService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;

@Service
public class EmployeeServiceImpl extends IBaseServiceImpl<Employee> implements IEmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public List<Employee> findAll() {
        List<EmployeeBo> lists = employeeMapper.findnoeee();
        ArrayList<Employee> employeeList = new ArrayList<>();
        for(EmployeeBo list : lists){
            Employee employee = new Employee();
            BeanUtils.copyProperties(list,employee);
            employeeList.add(employee);
        }
        return employeeList;
    }


    @Override
    public Employee findByLogininfoId(Long id) {
        return employeeMapper.findByLogininfoId(id);
    }

    @Override
    public List<Long> findRoleByEmpId(Long id) {
        return employeeMapper.findRoleByEmpId(id);
    }
}
